package org.cosmact.designer.vxml.gefeditor.editor;

import org.cosmact.designer.vxml.gefeditor.editpart.DialogConnectionEditPart;
import org.cosmact.designer.vxml.gefeditor.editpart.DialogEditPart;
import org.cosmact.designer.vxml.gefeditor.editpart.DocumentEditPart;
import org.cosmact.vxml.model.Dialog;
import org.cosmact.vxml.model.DialogConnection;
import org.cosmact.vxml.model.Document;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPartFactory;

public class GraphicalPartFactory implements EditPartFactory {

	public EditPart createEditPart(EditPart context, Object model) {
		EditPart child = null;

		if (model instanceof Document) {
			child = new DocumentEditPart();
		} else if (model instanceof Dialog) {
			child = new DialogEditPart();
		} else if(model instanceof DialogConnection){
			child = new DialogConnectionEditPart();
		}
		
		child.setModel(model);
		return child;
	}

}
